﻿@using Mozlite;
@using Mozlite.Common;
@using Mozlite.Common.Configuration
@using Mozlite.Web;
@using Mozlite.FileStorages;
@using Mozlite.Web.Controls;

@*
    显示状态信息，包含关闭按钮，控制面板中使用
*@
@helper ShowDialogStatus(dynamic status)
{
    if(status.__Status != null){
        if (status.__StatusType == true)
        {
        <div class="ui-state-error ui-corner-all" style="padding: 0 .7em;"> 
		    <p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span> 
            @status.__Status
            </p>
	    </div>
        }
        else if (status.__StatusType == false)
        {
        <div class="homepage-news-wrapper">
            <div id="page-comments">
    	        <div class="page-comment-interior">
			        <div class="comments-container">
                        <div class="dialog_status">
                            @status.__Status
                        </div>
                        <div style="text-align:center;">
                            <button class="ui-button button1" onclick="parent.closeModal(); parent.document.location.reload(); return false;">
		                        <span>
			                        <span>@Resources.GetString("Dialog.Closed")</span>
		                        </span>
	                        </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        }
    }
}

@*
 显示文件类型
*@
@helper ShowFileType(string extension)
{
    var type = MimeTypes.GetFileType(extension);
    switch (type)
    {
        case FileType.Other:
        case FileType.Application:
        case FileType.TEXT:
        {
            @string.Format(Resources.GetString(FileType.Other), extension.ToUpper())
        }
        break;
        default:
        {
            @Resources.GetString(type)
        } break;
    } 
}